package com.gary.springcloud.service;

import com.gary.springcloud.entity.CommonResult;
import com.gary.springcloud.entity.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 *  feign 服务调用封装接口给
 *  FeignClient 标注该接口是一个用于远程调用的接口
 * @author pengrui
 * @date 2021/1/10 - 14:05
 */
@Component
@FeignClient(value = "CLOUD-PROVIDER-PAYMENT")
public interface IPaymentFeignService {

    /**
     *  通过id查询
     * @param id id
     * @return CommonResult
     */
    @GetMapping("/payment/query/{id}")
    CommonResult<Payment> queryById(@PathVariable("id") Long id);

    /**
     * 超时测试
     * @return
     */
    @GetMapping("/payment/feign/timeout")
    CommonResult<String> timeout();
}
